package cool.mor.controller;

import cool.mor.dto.SalaryManagementPageQueryDto;
import cool.mor.dto.SalaryManagementSalaryQueryDto;
import cool.mor.form.SalaryManagementPageQueryForm;
import cool.mor.service.SalaryManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Ivan
 */
@RestController
public class SalaryManagementController {
    @Autowired
    SalaryManagementService salaryManagementService;
    /**
     * 前端向后端发送一个分页请求，参数包括page和size
     *  后端向前端返回一个分页对象page
     */
    @GetMapping(value = "getSalaryManagementDataByPage")
    public SalaryManagementPageQueryDto getSalaryManagementDataByPage(SalaryManagementPageQueryForm salaryManagementPageQueryForm){
        return salaryManagementService.querySalaryManagementDataByPage(salaryManagementPageQueryForm);
    }
    /**
     * 前端遍历分页对象，取得每个对象id后，向后端请求每个对象的所在部门，奖惩总额和薪资总和，以及缺勤记录
     */
    @GetMapping(value = "getSalaryManagementSalary")
    public SalaryManagementSalaryQueryDto getSalaryManagementSalary(String employeeId){
        return salaryManagementService.querySalaryManagementSalary(employeeId);
    }
}
